home *** CD-ROM | disk | FTP | other *** search
/ 17 Bit Software 3: The Continuation / 17-Bit_The_Continuation_Disc.iso / amigan / amigan 7 / batcher / batcher.c next >
Encoding:
C/C++ Source or Header  |  1994-01-27  |  2.8 KB  |  51 lines

  1. /****************************************************************
  2.  *         batcher.c - AmigaDos batch file processor            *
  3.  *                                                              *
  4.  *   Copyright(C) 1986, W. Wesley Howe - All Rights Reserved    *
  5.  *      A limited Right of Non-Commercial copying & use         *
  6.  *      is granted, provided this notice is also copied.        *
  7.  *      No warranties are expressed on the suitability          *
  8.  *     of this program for any use is conveyed or implied.      *
  9.  *                                                              *
  10.  * Purpose:  To allow usage of batch files without having to    *
  11.  *           use the Execute command. Primarily for those who   *
  12.  *           want to make system usage easy for the less        *
  13.  *           literate, and those of us that are plain lazy.     *
  14.  *                                                              *
  15.  * Usage:    Rename your AmigaDos batch file to end with ".bat" *
  16.  *           (must not contain any spaces in filename), then    *
  17.  *           rename the compiled version of this program to the *
  18.  *           old name of the batch file.                        *
  19.  *                                                              *
  20.  * Compile:  Compile with Lattice "C" V.3.03. Use -v -s options *
  21.  *           on lc2 for a small (2320 byte) executable file     *
  22.  *           (link as normal with Alink). Normal with Alink     *
  23.  *           means it takes longer to link this than to compile *
  24.  *           the whole thing.                                   *
  25.  *                                                              *
  26.  * Warnings: All of the normal support of AmigaDos is missing   *
  27.  *           from this program (No stdin, stdout, etc.) These   *
  28.  *           facilities are restored when the program calls     *
  29.  *           Execute(). Program has not been tested from the    *
  30.  *           Workbench (I never use it.)                        *
  31.  *                                                              *
  32.  ****************************************************************/
  33.  
  34. #define LINELEN          128
  35. char ExecLine[LINELEN] = "execute ";
  36. char BatchExt[]        = ".bat ";
  37.  
  38. _main(CmdLine)        /* shortcut around main() */
  39. char *CmdLine;
  40.    {
  41.    int c, j = 8, i = 0;
  42.    while((c=(*(CmdLine++)))!=' ') ExecLine[j++]=c;  /* gets own name   */
  43.    while(ExecLine[j++]=BatchExt[i++]);              /* append .bat     */
  44.    --j;                                        /* point at terminator  */
  45.    if(c) while(ExecLine[j++]=(*(CmdLine++)));  /* remainder of CmdLine */
  46.    Execute(ExecLine, 0, 0);                    /* see AmigaDos manual  */
  47.    _exit(0);                                   /* no level 2 support   */
  48.    }
  49.                                                /* that's all, folks.   */
  50.  
  51.